<div class="content-wrapper" [@routerTransition]>
    <sub-header idName="Administration.Taxonomy" [title]="'Taxonomy' | localize">
        <div role="actions">
            <button (click)="createNews()" *ngIf="'Pages_Manage_Taxonomy_Create' | permission"
                class="btn btn-primary blue mr-1"><i class="fa fa-plus"></i> {{"CreateNew" | localize}}
            </button>
            <button (click)="changeState(true)" *ngIf="'Pages_Manage_Taxonomy_Update' | permission"
                class="btn btn-primary blue mr-1"><i class="fa fa-book"></i> {{"Release" | localize}}
            </button>
            <button (click)="changeState(false)" *ngIf="'Pages_Manage_Taxonomy_Update' | permission"
                class="btn btn-warning mr-1"><i class="fa fa-reply"></i> {{"CancelRelease" | localize}}
            </button>
            <button (click)="delete()" *ngIf="'Pages_Manage_Taxonomy_Delete' | permission" class="btn btn-warning">
                <i class="fa fa-trash"></i> {{"Delete" | localize}}
            </button>
        </div>
    </sub-header>
    <!-- /.content-header -->
    <!-- Main content -->
    <section class="content d-flex flex-column flex-column-fluid">
        <div [class]="containerClass">
            <div class="card card-custom gutter-b">
                <div class="card-body">
                    <form class="form" autocomplete="new-password">
                        <div>
                            <div class="row align-items-center mb-4">
                                <div class="col-xl-12">
                                    <div class="form-group m-form__group align-items-center">
                                        <div class="input-group">
                                            <input [(ngModel)]="filterText" name="filterText" autoFocus
                                                class="form-control m-input" [placeholder]="l('SearchWithThreeDot')"
                                                type="text">
                                            <div class="input-group-append">
                                                <button (click)="getListData()" class="btn btn-default" type="submit">
                                                    <i class="icon-magnifier" [attr.aria-label]="l('Search')"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>


                    <div class="row align-items-center">
                        <!--<Primeng-TurboTable-Start>-->
                        <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                            <p-table #dataTable sortMode="multiple" 
                                [value]="primengTableHelper.records"
                                rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false"
                                 [responsive]="primengTableHelper.isResponsive"
                                [resizableColumns]="primengTableHelper.resizableColumns"
                                [(selection)]="selectedDatas"
                                dataKey="id" 
                                selectionMode="multiple">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width:38px">
                                            <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
                                        </th>
                                        <th style="width:150px">
                                            {{'Title' | localize}}
                                        </th>
                                        <th style="width:150px">
                                            {{'LocalDisplayName' | localize}}
                                        </th>
                                        <th style="width:150px">
                                            {{'ViewDetail' | localize}}
                                        </th>
                                        <th style="width:120px">
                                            {{'Order' | localize}}
                                        </th>
                                        <th style="width:100px">
                                            {{'IsTree' | localize}}
                                        </th>
                                        <th style="width:100px">
                                            {{'ReleaseState' | localize}}
                                        </th>
                                        <th style="width: 200px">
                                            {{'CreationTime' | localize}}
                                        </th>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="body" let-record="$implicit">
                                    <tr>
                                        <td style="width: 38px">
                                            <p-tableCheckbox [value]="record" (click)="$event.stopPropagation()">
                                            </p-tableCheckbox>
                                        </td>
                                        <td style="width: 150px">
                                            <span class="p-column-title"> {{'Title' | localize}}</span>
                                            <a title="{{record.title}}" href="javascript:void(0)"
                                                (click)="editInfo(record)">{{record.title}}</a>
                                        </td>
                                        <td style="width: 150px">
                                            <span class="p-column-title"> {{'LocalDisplayName' | localize}}</span>
                                            {{record.localDisplayName}}
                                        </td>
                                        <td style="width: 150px">
                                            <a href="javascript:void(0)" (click)="goToDetail(record)">{{'ViewDetail' |
                                                localize}}</a>
                                        </td>
                                        <td style="width: 120px">
                                            <span class="p-column-title"> {{'Order' | localize}}</span>
                                            {{record.norder}}
                                        </td>
                                        <td style="width: 100px">
                                            <span class="p-column-title"> {{'IsTree' | localize}}</span>
                                            <span class="label label-success label-inline" *ngIf="record.isTree">{{'Yes'
                                                | localize}}</span>
                                            <span class="label label-dark label-inline" *ngIf="!record.isTree">{{'No' |
                                                localize}}</span>
                                        </td>
                                        <td style="width: 100px">
                                            <span class="p-column-title"> {{'ReleaseState' | localize}}</span>
                                            <span class="label label-success label-inline"
                                                *ngIf="record.isActive">{{'Yes' | localize}}</span>
                                            <span class="label label-dark label-inline" *ngIf="!record.isActive">{{'No'
                                                | localize}}</span>
                                        </td>
                                        <td style="width: 200px">
                                            <span class="p-column-title"> {{'CreationTime' | localize}}</span>
                                            {{record.creationTime | luxonFormat:'F'}}
                                        </td>
                                    </tr>
                                </ng-template>
                            </p-table>
                            <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                                {{'NoData' | localize}}
                            </div>
                            <div class="primeng-paging-container">
                                <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                    (onPageChange)="getListData($event)"
                                    [totalRecords]="primengTableHelper.totalRecordsCount"
                                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage"
                                    [showCurrentPageReport]="true"
                                    [currentPageReportTemplate]="'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount">
                                </p-paginator>
                            </div>
                        </div>
                        <!--<Primeng-TurboTable-End>-->
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<create-or-edit-taxonomy-modal  #createOrEditTaxonomyModal (callback)="reloadPage()"></create-or-edit-taxonomy-modal>
<taxonomy-item-modal  #taxonomyItemModal  (callback)="reloadPage()"></taxonomy-item-modal>